package com.ruoyi.web.controller.system;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.dto.IndicatorDTO;
import com.ruoyi.common.core.domain.vo.IndicatorVO;
import com.ruoyi.common.core.domain.vo.GoalDetailVO;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.service.ISysConfigService;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

/**
 * 绩效目标
 * 
 * @author ruoyi
 */
@RestController
@RequestMapping("/project")
public class GoalController extends BaseController
{
    private ISysConfigService configService;

    /**
     * 罗列当前项目的所有绩效指标
     * @param projectId
     * @return
     */
    @GetMapping("/{projectId}/goal")
    public TableDataInfo list(@PathVariable String projectId)
    {
        startPage();
        List<IndicatorVO> list = new ArrayList<>();
        return getDataTable(list);
    }

    /**
     * 新增绩效指标
     * @param projectId
     * @param indicatorDTO
     * @return
     */
    @PostMapping("/{projectId}/indicator")
    public AjaxResult insert(@PathVariable String projectId, IndicatorDTO indicatorDTO)
    {
        int affectRows = 1;
        return toAjax(affectRows);
    }

    /**
     * 查看绩效指标详情
     * @param projectId
     * @param indicatorId
     * @return
     */
    @GetMapping("/{projectId}/indicator/{indicatorId}")
    public AjaxResult detail(@PathVariable String projectId,@PathVariable String indicatorId)
    {

        return AjaxResult.success(new GoalDetailVO());
    }

    /**
     * 修改绩效指标
     * @param projectId
     * @param indicatorId
     * @param indicatorDTO
     * @return
     */
//    @Log(title = "参数管理", businessType = BusinessType.UPDATE)
    @PutMapping("/{projectId}/indicator/{indicatorId}")
    public AjaxResult edit(@PathVariable String projectId,@PathVariable String indicatorId, IndicatorDTO indicatorDTO)
    {
        int affectRows = 1;
        return toAjax(affectRows);
    }

    /**
     * 删除绩效指标
     * @param projectId
     * @param indicatorId
     * @return
     */
//    @Log(title = "参数管理", businessType = BusinessType.DELETE)
    @DeleteMapping("/{projectId}/indicator/{indicatorId}")
    public AjaxResult remove(@PathVariable String projectId,@PathVariable String indicatorId)
    {
        // 删除
        return success();
    }
}
